package com.live.video.util;


import com.live.video.enums.ResultEnum;

/**
 * 返回结果处理工具类
 *
 * @author 戴长春    dcc@vtc365.com
 * @ClassName: ResultUtil
 * @Description: TODO()
 * @date 2017年3月30日 下午3:59:38
 */
public class ResultUtil {

    public static Result success(Object object) {
        Result result = new Result();
        result.setCode(ResultEnum.SUCCESS.getCode());
        result.setMsg(ResultEnum.SUCCESS.getMsg());
        result.setData(object);
        return result;
    }

    public static Result success() {
        return success(null);
    }

    public static Result error(Integer code, String msg) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }

    public static Result error(ResultEnum resultEnum) {
        Result result = new Result();
        result.setCode(resultEnum.getCode());
        result.setMsg(resultEnum.getMsg());
        return result;
    }
}
